<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="90px">
            <el-row>
                <el-col :span="3" v-hasPermi="['agriculture:process:siftTown']">
                    <el-form-item prop="townName" label-width="40px" style="margin:0">
                        <el-select placeholder="全部乡" v-model="queryParams.townName" @change="handleQueryTown" clearable
                            :style="{ width: '100%' }" size="small">
                            <el-option v-for="item in townOptions" :key="item.label" :label="item.label"
                                :value="item.label">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="4" v-hasPermi="['agriculture:process:siftTown']">
                    <el-form-item prop="villageName" label-width="40px" style="margin:0">
                        <el-select placeholder="全部村" v-model="queryParams.villageName" @change="handleQuery" size="small"
                            clearable :style="{ width: '100%' }">
                            <el-option v-for="item in villageOptions" :key="item.label" :label="item.label"
                                :value="item.label">
                            </el-option>
                        </el-select>
                    </el-form-item>

                </el-col>

                <el-col :span="16">
                    <el-form-item prop="villageName" label-width="40px" style="margin:0"
                        v-hasPermi="['agriculture:subsidy:siftVillage']">
                        <el-select placeholder="全部村" v-show="!isAdmin" v-model="queryParams.villageName"
                            @change="handleQuery" size="small" clearable :style="{ width: '100%' }">
                            <el-option v-for="item in villageOptions" :key="item.label" :label="item.label"
                                :value="item.label">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-col>

                <el-col :span="8" style="float:right;margin:0">
                    <el-form-item prop="year" label-width="40px" style="float:right;">
                        <el-select v-model="queryParams.year" :style="{ width: '100%' }">
                            <el-option v-for="year in yearOptions" :key="year" :label="year" :value="year" />
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="16">
                    <el-form-item label="身份证号码" prop="idCard">
                        <el-input v-model="queryParams.idCard" placeholder="请输入身份证号码" clearable size="small"
                            @keyup.enter.native="handleQuery" />
                    </el-form-item>
                    <el-form-item label="一卡通号码" prop="bankCard">
                        <el-input v-model="queryParams.bankCard" placeholder="请输入一卡通号码" clearable size="small"
                            @keyup.enter.native="handleQuery" />
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
                        <!-- <el-button type="warning" plain icon="el-icon-download" size="mini"
                            @click="handleExport">导出</el-button> -->
                    </el-form-item>
                </el-col>
                <el-col :span="6" style="float:right;margin:0">
                    <el-form-item label="补贴类型" prop="exportType" style="float:right;">
                        <el-select v-model="queryParams.exportType" @change="selectType" size="small"
                            :style="{ width: '100%' }">
                            <el-option v-for="item in subsidyOptions" :label="item.label" :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>

                </el-col>
            </el-row>
        </el-form>
        <el-drawer :title="title" :visible.sync="produceDialog" :with-header="false" direction="rtl" size="70%"
            custom-class="demo-drawer">
            <div class="demo-drawer__content">
                <el-form ref="produceRef" :disabled="true" :model="rejProduceForm" size="medium" label-width="130px"
                    label-position="left">
                    <div class="card-container">
                        <el-card class="infoDiv">
                            <span class="corner-label">基本信息</span>
                            <el-row :gutter="24">
                                <el-col :span="12">
                                    <el-form-item label="身份证号码" prop="idCard">
                                        <el-input :disabled="true" v-model="rejProduceForm.idCard" :maxlength="18"
                                            :style="{ width: '100%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="申请人" prop="appyBy">
                                        <el-input :disabled="true" v-model="rejProduceForm.appyBy"
                                            :style="{ width: '100%' }">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="24">
                                <el-col :span="6">
                                    <el-form-item label="性别" prop="sex" label-width="40px">
                                        <el-input :disabled="true" v-model="rejProduceForm.sex" :style="{ width: '100%' }">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6">
                                    <el-form-item label="年龄" prop="age" label-width="40px">
                                        <el-input :disabled="true" v-model="rejProduceForm.age"
                                            :style="{ width: '100%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="身份证地址" prop="idcardAddr">
                                        <el-input :disabled="true" v-model="rejProduceForm.idCardAddr"
                                            :style="{ width: '100%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="24">
                                <el-col :span="12">
                                    <el-form-item label="现住地址" prop="oftenAddr">
                                        <el-input :disabled="true" v-model="rejProduceForm.oftenAddr"
                                            :style="{ width: '100%' }">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="联系方式" prop="phone">
                                        <el-input :disabled="true" v-model="rejProduceForm.phone" :maxlength="11"
                                            :style="{ width: '100%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="24">
                                <el-col :span="12">
                                    <el-form-item label="一卡通账号" prop="bankCard">
                                        <el-input :disabled="true" v-model="rejProduceForm.bankCard" show-word-limit
                                            :style="{ width: '100%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-card>
                    </div>
                    <div class="card-container">
                        <el-card class="infoDiv">
                            <span class="corner-label">补贴类型</span>
                            <el-row :gutter="24">
                                <el-col :span="12">
                                    <el-form-item label="玉米补贴面积" prop="yumiareaAmount">
                                        <el-input :disabled="true" v-model="rejProduceForm.yumiareaAmount" show-word-limit
                                            :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12" :style="{ width: '100%' }"></el-col>
                            </el-row>
                            <el-row :gutter="24">
                                <el-col :span="12">
                                    <el-form-item label="大豆补贴面积" prop="dadouareaAmount">
                                        <el-input :disabled="true" v-model="rejProduceForm.dadouareaAmount" show-word-limit
                                            :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12" :style="{ width: '100%' }"></el-col>
                            </el-row>
                            <el-row :gutter="24">
                                <el-col :span="4">
                                    <el-form-item label="稻谷补贴面积" prop="areaAmount">
                                    </el-form-item>
                                </el-col>
                                <el-col :span="7">
                                    <el-form-item label="地表水" prop="daogudibiareaAmount" label-width="60px">
                                        <el-input v-model="rejProduceForm.daogudibiareaAmount" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="7">
                                    <el-form-item label="地下水" prop="daogudixiaareaAmount" label-width="60px">
                                        <el-input v-model="rejProduceForm.daogudixiaareaAmount" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6">
                                    <el-form-item label="合计" prop="daoguheareaAmount" label-width="40px">
                                        <el-input :disabled="true" v-model="rejProduceForm.daoguheareaAmount" type="number"
                                            :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="24">
                                <el-col :span="24">
                                    <el-form-item label="合计补贴面积" prop="areaAmount">
                                        <el-input :disabled="true" v-model="rejProduceForm.areaAmount"
                                            :style="{ width: '50%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-card>
                    </div>
                </el-form>

            </div>
        </el-drawer>
        <!-- 耕地地力审批抽屉 -->
        <el-drawer :title="title" :visible.sync="farmlandDialog" :with-header="false" direction="rtl" size="70%"
            custom-class="demo-drawer">
            <div class="demo-drawer__content">
                <el-form ref="farmlandRef" :disabled="true" :model="rejFarmlandForm" size="medium" label-width="130px"
                    label-position="left">
                    <div class="card-container">
                        <el-card class="infoDiv">
                            <span class="corner-label">基本信息</span>
                            <el-row :gutter="24">
                                <el-col :span="12">
                                    <el-form-item label="身份证号码" prop="idCard">
                                        <el-input :disabled="true" v-model="rejFarmlandForm.idCard" :maxlength="18"
                                            :style="{ width: '100%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="申请人" prop="appyBy">
                                        <el-input :disabled="true" v-model="rejFarmlandForm.appyBy"
                                            :style="{ width: '100%' }">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="24">
                                <el-col :span="6">
                                    <el-form-item label="性别" prop="sex" label-width="40px">
                                        <el-input :disabled="true" v-model="rejFarmlandForm.sex" :style="{ width: '100%' }">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6">
                                    <el-form-item label="年龄" prop="age" label-width="40px">
                                        <el-input :disabled="true" v-model="rejFarmlandForm.age"
                                            :style="{ width: '100%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="身份证地址" prop="idcardAddr">
                                        <el-input :disabled="true" v-model="rejFarmlandForm.idCardAddr"
                                            :style="{ width: '100%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="24">
                                <el-col :span="12">
                                    <el-form-item label="现住地址" prop="oftenAddr">
                                        <el-input :disabled="true" v-model="rejFarmlandForm.oftenAddr"
                                            :style="{ width: '100%' }">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="联系方式" prop="phone">
                                        <el-input :disabled="true" v-model="rejFarmlandForm.phone" :maxlength="11"
                                            :style="{ width: '100%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="24">
                                <el-col :span="16">
                                    <el-form-item label="一卡通账号" prop="bankCard">
                                        <el-input :disabled="true" v-model="rejFarmlandForm.bankCard" show-word-limit
                                            :style="{ width: '100%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-card>
                    </div>
                    <div class="card-container">
                        <el-card class="infoDiv">
                            <span class="corner-label">补贴类型</span>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="14">
                                    <el-form-item label="耕地地力补贴面积" prop="farmlandareaAmount" label-width="160px">
                                        <el-input :disabled="true" v-model="rejFarmlandForm.farmlandareaAmount"
                                            type="number" clearable :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-card>
                    </div>
                </el-form>

            </div>
        </el-drawer>
        <!-- 耕地轮作审批抽屉 -->
        <el-drawer :title="title" :visible.sync="cropfarmlandDialog" :with-header="false" direction="rtl" size="70%"
            custom-class="demo-drawer">
            <div class="demo-drawer__content">
                <el-form ref="cropfarmlandRef" :model="rejCropFarmlandForm" size="medium" label-width="130px"
                    label-position="left">
                    <div class="card-container">
                        <el-card class="infoDiv">
                            <span class="corner-label">基本信息</span>
                            <el-row :gutter="24">
                                <el-col :span="12">
                                    <el-form-item label="身份证号码" prop="idCard">
                                        <el-input :disabled="true" v-model="rejCropFarmlandForm.idCard" :maxlength="18"
                                            :style="{ width: '100%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="申请人" prop="appyBy">
                                        <el-input :disabled="true" v-model="rejCropFarmlandForm.appyBy"
                                            :style="{ width: '100%' }">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="24">
                                <el-col :span="6">
                                    <el-form-item label="性别" prop="sex" label-width="40px">
                                        <el-input :disabled="true" v-model="rejCropFarmlandForm.sex"
                                            :style="{ width: '100%' }">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6">
                                    <el-form-item label="年龄" prop="age" label-width="40px">
                                        <el-input :disabled="true" v-model="rejCropFarmlandForm.age"
                                            :style="{ width: '100%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="身份证地址" prop="idcardAddr">
                                        <el-input :disabled="true" v-model="rejCropFarmlandForm.idCardAddr"
                                            :style="{ width: '100%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="24">
                                <el-col :span="12">
                                    <el-form-item label="现住地址" prop="oftenAddr">
                                        <el-input :disabled="true" v-model="rejCropFarmlandForm.oftenAddr"
                                            :style="{ width: '100%' }">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="联系方式" prop="phone">
                                        <el-input :disabled="true" v-model="rejCropFarmlandForm.phone" :maxlength="11"
                                            :style="{ width: '100%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="24">
                                <el-col :span="16">
                                    <el-form-item label="一卡通账号" prop="bankCard">
                                        <el-input :disabled="true" v-model="rejCropFarmlandForm.bankCard" show-word-limit
                                            :style="{ width: '100%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-card>
                    </div>
                    <div class="card-container">
                        <el-card class="infoDiv">
                            <span class="corner-label">轮作方式选择</span>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="24">
                                    <el-form-item label="轮作方式" label-width="100px" prop="lunzuoapplytype">
                                        <el-checkbox-group  :disabled="true"   v-model="rejCropFarmlandForm.lunzuoapplytype">
                                            <div v-for="(type, index) in rotationTypeOptions" :key="type.value">
                                                <el-checkbox :label="type.value">
                                                    {{ type.label }}
                                                </el-checkbox>
                                            </div>

                                        </el-checkbox-group>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="24">
                                    <el-form-item label-width="200px" :label="`${year}年合计轮作补贴面积`" prop="cropall">
                                        <el-input :disabled="true" v-model="rejCropFarmlandForm.cropall"
                                            :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="24">
                                    <el-form-item label="备注" prop="remark">
                                        <el-input :disabled="true" v-model="rejCropFarmlandForm.remark" type="textarea"
                                            :autosize="{ minRows: 1, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>

                        </el-card>
                    </div>
                    <div class="card-container" v-if="rejCropFarmlandForm.lunzuoapplytype.includes(1)">
                        <el-card class="infoDiv">
                            <span class="corner-label">第一种轮作</span>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${preyear}年玉米种植面积`" prop="preyuone">
                                        <el-input :disabled="true" v-model="rejCropFarmlandForm.preyuone" type="number" 
                                            :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${preyear}年小麦种植面积`" prop="prexiaoone">
                                        <el-input :disabled="true"  v-model="rejCropFarmlandForm.prexiaoone" type="number"
                                            :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12" :style="{ width: '100%' }"></el-col>
                            </el-row>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${preyear}年薯类补贴面积`" prop="preshuone">
                                        <el-input  :disabled="true" v-model="rejCropFarmlandForm.preshuone" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${preyear}年杂粮补贴面积`" prop="prezaone">
                                        <el-input :disabled="true"  v-model="rejCropFarmlandForm.prezaone" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${preyear}年经济作物种植面积`" prop="prejinjione">
                                        <el-input  :disabled="true" v-model="rejCropFarmlandForm.prejinjione" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>

                            <div class="green-line"></div>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="24">
                                    <el-form-item label-width="300px" :label="`${year}年大豆种植补贴面积（第一种轮作）`" prop="curallone">
                                        <el-input  :disabled="true" v-model="rejCropFarmlandForm.curallone" type="number"
                                            :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>

                        </el-card>
                    </div>
                    <div class="card-container" v-if="rejCropFarmlandForm.lunzuoapplytype.includes(2)">
                        <el-card class="infoDiv">
                            <span class="corner-label">第二种轮作</span>

                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="24">
                                    <el-form-item label-width="400px" :label="`${lastyear}年种植玉米等其他作物、${preyear}年轮作种植大豆面积`"
                                        prop="preyutwo">
                                        <el-input  :disabled="true"  v-model="rejCropFarmlandForm.preyutwo" type="number"
                                            :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <div class="green-line"></div>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="24">
                                    <el-form-item label-width="300px" :label="`${year}年大豆种植补贴面积（第二种轮作）`" prop="curalltwo">
                                        <el-input :disabled="true" v-model="rejCropFarmlandForm.curalltwo"
                                            :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>

                        </el-card>
                    </div>
                    <div class="card-container" v-if="rejCropFarmlandForm.lunzuoapplytype.includes(3)">
                        <el-card class="infoDiv">
                            <span class="corner-label">第三种轮作</span>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${preyear}年大豆种植面积`" prop="predathree">
                                        <el-input :disabled="true"  v-model="rejCropFarmlandForm.predathree" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${preyear}年杂豆种植面积`" prop="prezathree">
                                        <el-input  :disabled="true" v-model="rejCropFarmlandForm.prezathree" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>

                            </el-row>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${preyear}年玉米种植面积`" prop="preyuthree">
                                        <el-input :disabled="true"  v-model="rejCropFarmlandForm.preyuthree" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col> <el-col :span="12" :style="{ width: '100%' }"></el-col>
                            </el-row>
                            <div class="green-line"></div>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${year}年小麦种植面积`" prop="curxiaothree">
                                        <el-input  :disabled="true" v-model="rejCropFarmlandForm.curxiaothree" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${year}年马铃薯种植面积`" prop="curmathree">
                                        <el-input  :disabled="true" v-model="rejCropFarmlandForm.curmathree" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${year}年甜菜种植面积`" prop="curtianthree">
                                        <el-input  :disabled="true" v-model="rejCropFarmlandForm.curtianthree" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <div class="green-line"></div>
                            <el-row :gutter="24">
                                <el-col :span="24">
                                    <!-- <el-form-item label-width="200px" style="color:gray" label="当甜菜的前茬为马铃薯时：" /> -->
                                    <span style="color:gray;font-weight: bold;">当甜菜的前茬为马铃薯时：</span>
                                </el-col>
                            </el-row>

                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${preyear}年马铃薯种植补贴面积`" prop="premathreenew">
                                        <el-input  :disabled="true" v-model="rejCropFarmlandForm.premathreenew" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${year}年甜菜种植补贴面积`" prop="curtianthreenew">
                                        <el-input :disabled="true" v-model="rejCropFarmlandForm.curtianthreenew"
                                            :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <div class="green-line"></div>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="24">
                                    <el-form-item label-width="300px" :label="`${year}年合计种植补贴面积（第三种轮作）`" prop="curallthree">
                                        <el-input :disabled="true" v-model="rejCropFarmlandForm.curallthree"
                                            :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-card>
                    </div>
                    <div class="card-container" v-if="rejCropFarmlandForm.lunzuoapplytype.includes(4)">
                        <el-card class="infoDiv">
                            <span class="corner-label">第四种轮作</span>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${preyear}年粮食作物补贴面积`" prop="preniangfour">
                                        <el-input  :disabled="true" v-model="rejCropFarmlandForm.preniangfour" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${preyear}年经济作物补贴面积`" prop="prejingjifour">
                                        <el-input :disabled="true"  v-model="rejCropFarmlandForm.prejingjifour" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <div class="green-line"></div>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${year}年花生种植补贴面积`" prop="curhuafour">
                                        <el-input :disabled="true"  v-model="rejCropFarmlandForm.curhuafour" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${year}年葵花籽种植补贴面积`" prop="curkuifour">
                                        <el-input :disabled="true"  v-model="rejCropFarmlandForm.curkuifour" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${year}年白瓜籽种植补贴面积`" prop="curbaifour">
                                        <el-input :disabled="true"  v-model="rejCropFarmlandForm.curbaifour" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${year}年油莎豆种植补贴面积`" prop="curyoushafour">
                                        <el-input  :disabled="true" v-model="rejCropFarmlandForm.curyoushafour" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>

                            </el-row>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${year}年油菜籽籽种植补贴面积`" prop="curyoucaifour">
                                        <el-input  :disabled="true" v-model="rejCropFarmlandForm.curyoucaifour" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${year}年芝麻种植补贴面积`" prop="curzhimafour">
                                        <el-input  :disabled="true" v-model="rejCropFarmlandForm.curzhimafour" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>

                            </el-row>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="12">
                                    <el-form-item label-width="200px" :label="`${year}年胡麻籽种植补贴面积`" prop="curhumafour">
                                        <el-input :disabled="true"  v-model="rejCropFarmlandForm.curhumafour" :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <div class="green-line"></div>
                            <el-row :gutter="24" style="margin-bottom: 10px; margin-top: 10px;">
                                <el-col :span="24">
                                    <el-form-item label-width="400px" :label="`${year}年合计油料作物种植补贴面积（第四种轮作）`"
                                        prop="curallfour">
                                        <el-input :disabled="true" v-model="rejCropFarmlandForm.curallfour" type="number"
                                            :style="{ width: '100%' }">
                                            <template slot="append">亩</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>

                        </el-card>
                    </div>

                </el-form>

            </div>
        </el-drawer>

        <!-- 高蛋白大豆审批抽屉 -->
        <el-drawer :title="title" :visible.sync="prosoyDialog" :with-header="false" direction="rtl" size="70%"
            custom-class="demo-drawer">
            <div class="demo-drawer__content">
                <el-form ref="prosoyRef" :disabled="true" :model="rejProsoyForm" size="medium" label-width="260px"
                    label-position="left">
                    <div class="card-container">
                        <el-card class="infoDiv">
                            <span class="corner-label">基本信息</span>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="申报补贴农民(职工、新型经营主体负责人)身份证号码" prop="idCard">
                                        <el-input v-model="rejProsoyForm.idCard" :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="申报补贴农民(职工、新型经营主体负责人)姓名" prop="appyBy">
                                        <el-input :disabled="true" v-model="rejProsoyForm.appyBy"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="申报补贴农民(职工、新型经营主体负责人)联系电话" prop="phone">
                                        <el-input :disabled="true" v-model="rejProsoyForm.phone"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="身份证地址" prop="idCardAddr">
                                        <el-input :disabled="true" v-model="rejProsoyForm.idCardAddr"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="现住地址" prop="oftenAddr">
                                        <el-input :disabled="true" v-model="rejProsoyForm.oftenAddr"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="申报补贴农民(职工、新型经营主体负责人)一卡通账号" prop="bankCard">
                                        <el-input :disabled="true" v-model="rejProsoyForm.bankCard"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-card>
                    </div>
                    <div class="card-container">
                        <el-card class="infoDiv">
                            <span class="corner-label">申报面积</span>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="自有耕地种植大豆面积(亩)" prop="ownArea">
                                        <el-input :disabled="true" v-model="rejProsoyForm.ownArea" type="number"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <!-- 动态行：使用 v-for 渲染每一条 -->
                            <el-row :gutter="16" v-for="(item, index) in rejProsoyForm.borrow" :key="index"
                                style="margin-bottom: 10px;">
                                <el-col :span="6">
                                    <el-form-item label="承租他人姓名" :prop="'borrow.' + index + '.borrowName'"
                                        label-width="100px">
                                        <el-input v-model="item.borrowName" placeholder="请输入" :style="{ width: '100%' }">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="9">
                                    <el-form-item label="承租他人耕地种植大豆面积(亩)" :prop="'borrow.' + index + '.borrowArea'"
                                        label-width="220px">
                                        <el-input v-model="item.borrowArea" type="number" show-word-limit
                                            :style="{ width: '100%' }">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="7">
                                    <el-form-item label="承租他人联系电话" :prop="'borrow.' + index + '.borrowPhone'"
                                        label-width="130px">
                                        <el-input v-model="item.borrowPhone" show-word-limit :style="{ width: '100%' }">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="承租他人耕地种植大豆面积(亩)" prop="borrowAmount">
                                        <el-input v-model="rejProsoyForm.borrowAmount" style="width: 80%" disabled>
                                            <template slot="append">（合计）</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item :label="`申报补贴农民(职工、新型经营主体)${year}年种植大豆面积(亩)`" prop="areaAmountdou">
                                        <el-input v-model="rejProsoyForm.areaAmountdou" :style="{ width: '80%' }"
                                            disabled><template slot="append">（合计）</template></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-card>
                    </div>
                    <div class="card-container">
                        <el-card class="infoDiv">
                            <span class="corner-label">其他情况</span>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label-width="420px" :label="`${preyear}年10月1日-${year}年6月30日前购买高蛋白大豆品种名称`"
                                        prop="gaodanbaiType">
                                        <el-input v-model="rejProsoyForm.gaodanbaiType" type="number"
                                            :style="{ width: '80%' }"></el-input>

                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label-width="420px"
                                        :label="`${preyear}年10月1日-${year}年6月30日前购买高蛋白大豆种子数量(斤)`" prop="gaodanbaiWeight">
                                        <el-input v-model="rejProsoyForm.gaodanbaiWeight" type="number"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label-width="420px" :label="`${year}年种植高蛋白大豆面积(亩)(品种粗蛋白含量≥43.0%)`"
                                        prop="areaAmountdouGaodanbai">
                                        <el-input v-model="rejProsoyForm.areaAmountdouGaodanbai" type="number"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label-width="420px" label="在何处购买的高蛋白大豆种子(填写具体名称)" prop="gaodanbaiWhere">
                                        <el-input v-model="rejProsoyForm.gaodanbaiWhere"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>

                        </el-card>
                    </div>
                    <div class="card-container">
                        <el-card class="infoDiv">
                            <span class="corner-label">附件上传</span>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label-width="220px" label="高蛋白大豆补贴申请表" prop="appyExcel">
                                        <el-upload class="upload-demo" :disabled="true"
                                            action="http://111.40.188.220:9060/subsidy/file/upload"
                                            :on-preview="handlePreview"
                                            :on-success="(response, file) => handleSuccess(response, file, 'appyExcel')"
                                            :limit="1" :on-exceed="handleExceed" :file-list="uploadedAppyExcel">
                                            <el-button :disabled="true" icon="el-icon-upload" plain
                                                type="primary">上传附件</el-button>
                                        </el-upload>
                                    </el-form-item>
                                </el-col>

                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label-width="220px" label="销售凭证" prop="saleFile">
                                        <el-upload class="upload-demo" :disabled="true"
                                            action="http://111.40.188.220:9060/subsidy/file/upload"
                                            :on-preview="handlePreview"
                                            :on-success="(response, file) => handleSuccess(response, file, 'saleFile')"
                                            :limit="1" :on-exceed="handleExceed" :file-list="uploadedSaleFile">
                                            <el-button :disabled="true" icon="el-icon-upload" plain
                                                type="primary">上传附件</el-button>
                                        </el-upload>
                                    </el-form-item>
                                </el-col>

                            </el-row>
                        </el-card>
                    </div>
                    <div class="card-container">
                        <el-card class="infoDiv">
                            <span class="corner-label">村级负责人信息</span>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label-width="200px" label="村级负责人" prop="chargeName">
                                        <el-input v-model="rejProsoyForm.chargeName" :style="{ width: '40%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label-width="200px" label="负责人职务" prop="chargePost">
                                        <el-input v-model="rejProsoyForm.chargePost" :style="{ width: '40%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="24">
                                    <el-form-item label-width="200px" label="负责人电话" prop="chargePhone">
                                        <el-input v-model="rejProsoyForm.chargePhone" :style="{ width: '40%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-card>
                    </div>

                </el-form>


            </div>
        </el-drawer>
        <!-- 高油大豆审批抽屉 -->
        <el-drawer :title="title" :visible.sync="oilsoyDialog" :with-header="false" direction="rtl" size="70%"
            custom-class="demo-drawer">
            <div class="demo-drawer__content">
                <el-form ref="oilsoyRef" :disabled="true" :model="rejOilsoyForm" size="medium" label-width="260px"
                    label-position="left">
                    <div class="card-container">
                        <el-card class="infoDiv">
                            <span class="corner-label">基本信息</span>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="申报补贴农民(职工、新型经营主体负责人)身份证号码" prop="idCard">
                                        <el-input :disabled="true" v-model="rejOilsoyForm.idCard"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="申报补贴农民(职工、新型经营主体负责人)姓名" prop="appyBy">
                                        <el-input :disabled="true" v-model="rejOilsoyForm.appyBy"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="申报补贴农民(职工、新型经营主体负责人)联系电话" prop="phone">
                                        <el-input :disabled="true" v-model="rejOilsoyForm.phone"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="身份证地址" prop="idCardAddr">
                                        <el-input :disabled="true" v-model="rejOilsoyForm.idCardAddr"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="现住地址" prop="oftenAddr">
                                        <el-input :disabled="true" v-model="rejOilsoyForm.oftenAddr"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="申报补贴农民(职工、新型经营主体负责人)一卡通账号" prop="bankCard">
                                        <el-input :disabled="true" v-model="rejOilsoyForm.bankCard"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-card>
                    </div>
                    <div class="card-container">
                        <el-card class="infoDiv">
                            <span class="corner-label">申报面积</span>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="自有耕地种植大豆面积(亩)" prop="ownArea">
                                        <el-input :disabled="true" v-model="rejOilsoyForm.ownArea" type="number"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <!-- 动态行：使用 v-for 渲染每一条 -->
                            <el-row :gutter="16" v-for="(item, index) in rejOilsoyForm.borrow" :key="index"
                                style="margin-bottom: 10px;">
                                <el-col :span="6">
                                    <el-form-item label="承租他人姓名" :prop="'borrow.' + index + '.borrowName'"
                                        label-width="100px">
                                        <el-input v-model="item.borrowName" placeholder="请输入" :style="{ width: '100%' }">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="9">
                                    <el-form-item label="承租他人耕地种植大豆面积(亩)" :prop="'borrow.' + index + '.borrowArea'"
                                        label-width="220px">
                                        <el-input v-model="item.borrowArea" type="number" show-word-limit
                                            :style="{ width: '100%' }">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="7">
                                    <el-form-item label="承租他人联系电话" :prop="'borrow.' + index + '.borrowPhone'"
                                        label-width="130px">
                                        <el-input v-model="item.borrowPhone" show-word-limit :style="{ width: '100%' }">
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="承租他人耕地种植大豆面积(亩)" prop="borrowAmount">
                                        <el-input v-model="rejOilsoyForm.borrowAmount" style="width: 80%" disabled>
                                            <template slot="append">（合计）</template>
                                        </el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item :label="`申报补贴农民(职工、新型经营主体)${year}年种植大豆面积(亩)`" prop="areaAmountdou">
                                        <el-input v-model="rejOilsoyForm.areaAmountdou" :style="{ width: '80%' }"
                                            disabled><template slot="append">（合计）</template></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-card>
                    </div>
                    <div class="card-container">
                        <el-card class="infoDiv">
                            <span class="corner-label">其他情况</span>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label-width="420px" :label="`${preyear}年10月1日-${year}年6月30日前购买高蛋白大豆品种名称`"
                                        prop="gaodanbaiType">
                                        <el-input v-model="rejOilsoyForm.gaodanbaiType" type="number"
                                            :style="{ width: '80%' }"></el-input>

                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label-width="420px"
                                        :label="`${preyear}年10月1日-${year}年6月30日前购买高蛋白大豆种子数量(斤)`" prop="gaodanbaiWeight">
                                        <el-input v-model="rejOilsoyForm.gaodanbaiWeight" type="number"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label-width="420px" :label="`${year}年种植高蛋白大豆面积(亩)(品种粗蛋白含量≥23.5%)`"
                                        prop="areaAmountdouGaodanbai">
                                        <el-input v-model="rejOilsoyForm.areaAmountdouGaodanbai" type="number"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label-width="420px" label="在何处购买的高蛋白大豆种子(填写具体名称)" prop="gaodanbaiWhere">
                                        <el-input v-model="rejOilsoyForm.gaodanbaiWhere"
                                            :style="{ width: '80%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>

                        </el-card>
                    </div>
                    <div class="card-container">
                        <el-card class="infoDiv">
                            <span class="corner-label">附件上传</span>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label-width="220px" label="高蛋白大豆补贴申请表" prop="appyExcel">
                                        <el-upload class="upload-demo"
                                            action="http://111.40.188.220:9060/subsidy/file/upload"
                                            :on-preview="handlePreview"
                                            :on-success="(response, file) => handleSuccess(response, file, 'appyExcel')"
                                            :limit="1" :on-exceed="handleExceed" :file-list="uploadedAppyExcel">
                                            <el-button icon="el-icon-upload" plain type="primary">上传附件</el-button>
                                        </el-upload>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label-width="220px" label="销售凭证" prop="saleFile">
                                        <el-upload class="upload-demo"
                                            action="http://111.40.188.220:9060/subsidy/file/upload"
                                            :on-preview="handlePreview"
                                            :on-success="(response, file) => handleSuccess(response, file, 'saleFile')"
                                            :limit="1" :on-exceed="handleExceed" :file-list="uploadedSaleFile">
                                            <el-button icon="el-icon-upload" plain type="primary">上传附件</el-button>
                                        </el-upload>
                                    </el-form-item>
                                </el-col>

                            </el-row>
                        </el-card>
                    </div>
                    <div class="card-container">
                        <el-card class="infoDiv">
                            <span class="corner-label">村级负责人信息</span>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label-width="200px" label="村级负责人" prop="chargeName">
                                        <el-input v-model="rejOilsoyForm.chargeName" :style="{ width: '40%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label-width="200px" label="负责人职务" prop="chargePost">
                                        <el-input v-model="rejOilsoyForm.chargePost" :style="{ width: '40%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="24">
                                    <el-form-item label-width="200px" label="负责人电话" prop="chargePhone">
                                        <el-input v-model="rejOilsoyForm.chargePhone" :style="{ width: '40%' }"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-card>
                    </div>
                </el-form>
            </div>
        </el-drawer>
        <!-- list.slice((pageNum - 1) * pageSize, pageNum * pageSize) -->
        <el-table v-loading="loading" :data="subsidyApplicationList" border style="width: 100%;">
            <!-- <el-table-column label="工单编号" align="center" prop="appNum" width="140" /> -->
            <el-table-column type="index" width="80" label="序号" align="center" key="1" />
            <el-table-column label="申请人" align="center" prop="appyBy" />

            <el-table-column label="身份证号码" align="center" prop="idCard" />
            <el-table-column label="一卡通号码" align="center" prop="bankCard" />
            <el-table-column label="乡" align="center" prop="townName" />
            <el-table-column label="村" align="center" prop="villageName" />
            <el-table-column label="申请时间" align="center" prop="year" />

            <template v-if="showYumiColumns">
                <el-table-column label="玉米补贴面积(亩)" align="center" prop="yumiareaAmount" key="6" />
                <el-table-column label="玉米补贴标准(元/亩)" align="center" key="7">
                    <template #default="scope">
                        {{ prcieForm.yumi || '—' }}
                    </template>
                </el-table-column>
                <el-table-column label="玉米补贴金额(元)" align="center" prop="yumiareaAmountPri" width="100" key="8" />

                <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120" key="9">
                    <template slot-scope="scope">
                        <el-button size="mini" type="text" @click="handleRejectProduce(scope.row)">查看</el-button>
                    </template>
                </el-table-column>

            </template>

            <template v-if="showDadouColumns">
                <el-table-column label="大豆补贴面积(亩)" align="center" prop="dadouareaAmount" width="100" key="10" />
                <el-table-column label="大豆补贴标准(元/亩)" align="center" width="100" key="11">
                    <template #default="scope">
                        {{ prcieForm.dadou || '—' }}
                    </template>
                </el-table-column>
                <el-table-column label="大豆补贴金额(元)" align="center" prop="dadouareaAmountPri" width="110" key="12" />
                <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100" key="13">
                    <template slot-scope="scope">
                        <el-button size="mini" type="text" @click="handleRejectProduce(scope.row)">查看</el-button>
                    </template>
                </el-table-column>
            </template>



            <template v-if="showDaoguColumns">
                <el-table-column label="稻谷补贴面积(亩)" align="center" prop="daoguheareaAmount" width="80" key="14" />

                <el-table-column label="稻谷补贴金额(元)" align="center" prop="daoguheareaAmountPri" width="80" key="15" />
                <el-table-column label="地表水(亩)" align="center" prop="daogudibiareaAmount" width="70" key="16" />

                <el-table-column label="地表水补贴标准(元/亩)" align="center" width="80" key="17">
                    <template #default="scope">
                        {{ prcieForm.daogudibiao || '—' }}
                    </template>
                </el-table-column>
                <el-table-column label="地表水补贴金额(元)" align="center" prop="daogudibiareaAmountPri" width="80" key="18" />
                <el-table-column label="地下水(亩)" align="center" prop="daogudixiaareaAmount" width="70" key="19" />


                <el-table-column label="地下水补贴标准(元/亩)" align="center" width="80" key="20">
                    <template #default="scope">
                        {{ prcieForm.daogudixia || '—' }}
                    </template>
                </el-table-column>
                <el-table-column label="地下水补贴金额(元)" align="center" prop="daogudixiaareaAmountPri" width="80" key="21" />
                <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
                    <template slot-scope="scope">
                        <el-button size="mini" type="text" @click="handleRejectProduce(scope.row)">查看</el-button>
                    </template>
                </el-table-column>
            </template>

            <template v-if="showGaodanColumns">
                <el-table-column label="高蛋白大豆补贴面积(亩)" align="center" prop="areaAmountdouGaodanbai" width="150" key="22" />
                <el-table-column label="高蛋白大豆补贴标准(元/亩)" align="center" width="120" key="23">
                    <template #default="scope">
                        {{ prcieForm.gaodanbaidadou || '—' }}
                    </template>
                </el-table-column>
                <el-table-column label="高蛋白大豆补贴金额(元)" align="center" prop="areaAmountdouGaoyouPri" width="110" key="24" />
                <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120" key="25">
                    <template slot-scope="scope">
                        <el-button size="mini" type="text" @click="handleRejectProsoy(scope.row)">查看</el-button>
                    </template>
                </el-table-column>
            </template>

            <template v-if="showGaoyouColumns">
                <el-table-column label="高油大豆补贴面积(亩)" align="center" prop="areaAmountdouGaoyou" width="120" key="26" />
                <el-table-column label="高油大豆补贴标准(元/亩)" align="center" width="100" key="27">
                    <template #default="scope">
                        {{ prcieForm.gaoyoudadou || '—' }}
                    </template>
                </el-table-column>
                <el-table-column label="高蛋白大豆补贴金额(元)" align="center" prop="areaAmountdouGaodanbaiPri" width="110"
                    key="28" />
                <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100" key="29">
                    <template slot-scope="scope">
                        <el-button size="mini" type="text" @click="handleRejectOilsoy(scope.row)">查看</el-button>
                    </template>
                </el-table-column>
            </template>
            <template v-if="showFarmColumns">
                <el-table-column label="耕地地力补贴面积(亩)" align="center" prop="farmlandareaAmount" width="120" key="30" />
                <el-table-column label="耕地地力补贴标准(元/亩)" align="center" width="100" key="31">
                    <template #default="scope">
                        {{ prcieForm.farmland || '—' }}
                    </template>
                </el-table-column>
                <el-table-column label="耕地地力补贴金额(元)" align="center" prop="farmlandareaAmountPri" width="110" key="32" />
                <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100" key="33">
                    <template slot-scope="scope">
                        <el-button size="mini" type="text" @click="handleRejectFarmland(scope.row)">查看</el-button>
                    </template>
                </el-table-column>
            </template>

            <template v-if="showCropFarmColumns">
                <el-table-column label="耕地轮作补贴面积(亩)" align="center" prop="cropall" width="120" key="30" />
                <el-table-column label="耕地轮作补贴标准(元/亩)" align="center" width="100" key="31">
                    <template #default="scope">
                        {{ prcieForm.cropfarmland || '—' }}
                    </template>
                </el-table-column>
                <el-table-column label="耕地轮作补贴金额(元)" align="center" prop="cropallpre" width="110" key="32" />
                <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100" key="33">
                    <template slot-scope="scope">
                        <el-button size="mini" type="text" @click="handleRejectCropFarmland(scope.row)">查看</el-button>
                    </template>
                </el-table-column>
            </template>

        </el-table>
        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
            @pagination="getList" />

    </div>
</template>
  
<script>
import { queryTownRes, getPrice, listProduce, submitSub, getProduceById, getProduceByappNum, submitProduce, rejectAllProduce, rejectProduce, approveProduce } from "@/api/agriculture/agriculture";
import { listStrativeArea, getStrativeArea, delStrativeArea, addStrativeArea, updateStrativeArea } from "@/api/subsidy/strativeArea";

export default {
    name: "Compile",

    data() {
        const now = new Date();
        return {
            year: now.getFullYear(),
            preyear:now.getFullYear()-1, //去年
            lastyear:now.getFullYear()-2, //前年
            // 遮罩层
            loading: true,
            // 总条数
            total: 0,
            // 表格数据
            subsidyApplicationList: [],
            pageNum: 1,
            pageSize: 10,

            title: '',
            form: {},
            townOptions: [],
            villageOptions: [],
            //补贴标准
            prcieForm: {
                yumi: undefined,
                dadou: undefined,
                // daogu: undefined,
                daogudibiao: undefined,
                daogudixia: undefined,
                gaodanbaidadou: undefined,
                gaoyoudadou: undefined,
                farmland: undefined,
                cropfarmland: undefined,
            },


            dialog: false,
            loading: false,
            isDisabled: true,  // 控制驳回是否禁用输入
            isAdmin: false,

            rejProduceForm: {}, //审批生产者表格
            rejOilsoyForm: {}, //审批高油大豆表格
            rejProsoyForm: {}, //审批高蛋白大豆表格
            rejFarmlandForm: {}, //审批耕地地力表格
            rejCropFarmlandForm: {
                lunzuoapplytype: [],
            }, //审批耕地轮作表格

            produceDialog: false, //抽屉的显示与隐藏
            prosoyDialog: false,
            oilsoyDialog: false,
            farmlandDialog: false,
            cropfarmlandDialog: false,

            uploadedAppyExcel: [], //申请表url存储
            uploadedSaleFile: [], //销售url存储

            subsidyOptions: [{
                "label": "玉米补贴",
                "value": "玉米补贴"
            }, {
                "label": "大豆补贴",
                "value": "大豆补贴"
            }, {
                "label": "稻谷补贴",
                "value": "稻谷补贴"
            }, {
                "label": "高油大豆补贴",
                "value": "高油大豆补贴"
            }, {
                "label": "高蛋白大豆补贴",
                "value": "高蛋白大豆补贴"
            }, {
                "label": "耕地地力补贴",
                "value": "耕地地力补贴"
            }, {
                "label": "耕地轮作补贴",
                "value": "耕地轮作补贴"
            }],

            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                appType: undefined,
                appNum: undefined,
                idCard: undefined,
                bankCard: undefined,
                villageName: undefined,
                townName: undefined,
                status: '已完成',
                exportType: '玉米补贴',
                year: new Date().getFullYear(),
                isprice: "2",
            },
        };
    },
    created() {
        this.role = this.$store.state.user.roles[0];
        // console.log("当前登录角色", this.role)

        if (this.$store.state.user.user.villageName) {
            this.queryParams.villageName = this.$store.state.user.user.villageName;
        }
        if (this.role == 'admin') {
            this.isAdmin = true;
        }

        if (this.role == 'town') {
            this.townName = this.$store.state.user.user.townName;
            this.queryParams.townName = this.townName
            console.log("当前登录角色乡名字", this.townName)
            listStrativeArea({ townName: this.townName }).then(response => {
                console.log("村列表数据展示", response[0].children[0].children)
                this.villageOptions = response[0].children[0].children;
                // if (this.villageOptions.length > 0) {
                //     this.queryParams.villageName = this.villageOptions[0].label; // 或 .value，看你要绑定哪个
                //     // 触发后续查询（可选）
                //     this.handleQuery(); // 如果你想在默认选中后立即查询
                // }
            })
        }

        if (this.role == 'district' || this.role == 'admin') {
            this.straName = '滴道区'
            this.queryParams.straName = this.straName
            listStrativeArea({ departmentName: '滴道区' }).then(response => {
                this.townOptions = response[0]?.children?.filter(item => item.type === 'town') || [];
                // if (this.townOptions.length > 0) {
                //     this.queryParams.townName = this.townOptions[0].label; // 或 .value，看你要绑定哪个
                //     this.updateVillageOptions()
                //     this.handleQuery(); // 如果你想在默认选中后立即查询
                // }
            })
        }
        this.getList();
    },
    mounted() {
        this.fetchPriceData();
    },

    computed: {
        // 生成年份选项，例如从当前年份往前推10年，往后推10年
        yearOptions() {
            const currentYear = new Date().getFullYear();
            const years = [];
            for (let i = currentYear - 10; i <= currentYear + 10; i++) {
                years.push(i);
            }
            return years;
        },
        //补贴数据展示
        showYumiColumns() {
            return this.queryParams.exportType === '玉米补贴';
        },
        showDadouColumns() {
            return this.queryParams.exportType === '大豆补贴';
        },
        showDaoguColumns() {
            return this.queryParams.exportType === '稻谷补贴';
        }
        ,
        showGaodanColumns() {
            return this.queryParams.exportType === '高蛋白大豆补贴';
        },
        showGaoyouColumns() {
            return this.queryParams.exportType === '高油大豆补贴';
        },
        showFarmColumns() {
            return this.queryParams.exportType === '耕地地力补贴';
        },
        showCropFarmColumns() {
            return this.queryParams.exportType === '耕地轮作补贴';
        }
    },
    methods: {
        fetchPriceData() {
            getPrice({ year: this.year })
                .then(res => {
                    const data = res || [];
                    console.log("补贴金额", data);

                    const mapping = {
                        '玉米补贴': 'yumi',
                        '大豆补贴': 'dadou',
                        // '稻谷补贴': 'daogu',
                        '稻谷地表水补贴': 'daogudibiao',
                        '稻谷地下水补贴': 'daogudixia',
                        '高蛋白大豆补贴': 'gaodanbaidadou',
                        '高油大豆补贴': 'gaoyoudadou',
                        '耕地地力补贴': 'farmland',
                        '耕地轮作补贴': 'cropfarmland',
                    };

                    data.forEach(item => {
                        const field = mapping[item.type];
                        console.log("补贴字段", field);
                        if (field) {
                            // 填充值（注意：price 可能是字符串）
                            this.prcieForm[field] = Number(item.price);
                        }
                    });
                })
                .catch(err => {
                    this.$message.error('获取补贴数据失败：' + (err.message || '网络错误'));
                    this.initSubmitStates(); // 出错时仍允许编辑
                });
        },
        updateVillageOptions() {
            // 清空当前村庄选择
            this.queryParams.villageName = '';

            if (!this.queryParams.townName) {
                this.villageOptions = [];
                return;
            }

            // 从 townOptions 中找到选中的乡镇
            const selectedTown = this.townOptions.find(town => town.label === this.queryParams.townName);

            // 设置村庄选项为其 children
            this.villageOptions = selectedTown?.children || [];
            console.log("村选项", this.villageOptions)
            // 如果有村庄，自动选中第一个
            if (this.villageOptions.length > 0) {
                this.queryParams.villageName = this.villageOptions[0].label; // 或 .value，看你要绑定哪个
                // 触发后续查询（可选）
                this.handleQuery(); // 如果你想在默认选中后立即查询
            }
        },

        // 当乡镇选择变化时触发
        handleQueryTown() {
            console.log("当前搜索条件", this.queryParams);
            this.updateVillageOptions();
            this.handleQuery();

            // 其他查询逻辑（如提交表单、刷新列表等）
        },
        // 补贴状态按钮切换
        selectType(value) {
            console.log("选择的类型", value);
            // 定义前三个是“生产者补贴”的类型
            const producerSubsidyTypes = [
                '玉米补贴',
                '大豆补贴',
                '稻谷补贴'
            ];
            // 判断并设置 queryParams.appType
            if (producerSubsidyTypes.includes(value)) {
                this.queryParams.appType = '生产者补贴';
            } else {
                this.queryParams.appType = value; // 高油大豆补贴、高蛋白大豆补贴等保持原值
            }
            this.handleQuery(); // 触发查询
        },

        getList() {
            this.subsidyApplicationList = []
            this.loading = true;
            listProduce(this.queryParams).then(response => {
                // console.log("归档数据", response);
                // this.subsidyApplicationList = response.rows;
                this.total = response.total;
                let list = response.rows || [];
                console.log("list", list)
                // 如果是生产者补贴下的细分类型，进行过滤
                // if (this.queryParams.appType === '生产者补贴') {
                //     if (this.queryParams.exportType === '玉米补贴') {
                //         list = list.filter(item => Number(item.yumiareaAmount) > 0);
                //     } else if (this.queryParams.exportType === '大豆补贴') {
                //         list = list.filter(item => Number(item.dadouareaAmount) > 0);
                //     } else if (this.queryParams.exportType === '稻谷补贴') {
                //         list = list.filter(item => Number(item.daoguheareaAmount) > 0);
                //     }
                // }
                // 其他类型（如高油/高蛋白）不需要过滤，直接显示
                this.subsidyApplicationList = list;

                
                this.loading = false;
            });
        },
        handleRejectProduce(row) {
            getProduceById(row.id).then(response => {
                this.rejProduceForm = response.data;
                this.produceDialog = true;
                this.title = "生产者补贴信息查看";
            });
        },
        handleRejectFarmland(row) {
            getProduceById(row.id).then(response => {
                this.rejFarmlandForm = response.data;
                this.farmlandDialog = true;
                this.title = "耕地地力补贴信息查看";
            });
        },
        handleRejectCropFarmland(row) {
            getProduceById(row.id).then(response => {
                this.rejCropFarmlandForm = response.data;
                this.cropfarmlandDialog = true;
                this.title = "耕地轮作补贴信息查看";
            });
        },
        //高油审批
        handleRejectOilsoy(row) {
            getProduceById(row.id).then(response => {
                const data = response.data;
                // 判断 borrow 是否为字符串，如果是，尝试解析为数组
                if (data.borrow && typeof data.borrow === 'string') {
                    try {
                        data.borrow = JSON.parse(data.borrow);
                    } catch (error) {
                        console.warn('解析 borrow 字段失败，使用空数组', error);
                        data.borrow = []; // 解析失败时给默认值
                    }
                } else if (!data.borrow) {
                    data.borrow = [];
                }
                this.title = "高蛋白大豆补贴信息查看";
                this.oilsoyDialog = true;
                this.rejOilsoyForm = data;
                this.uploadedAppyExcel.push({ name: '申请表', url: this.rejOilsoyForm.appyExcel })
                this.uploadedSaleFile.push({ name: '销售凭证', url: this.rejOilsoyForm.saleFile });

            });
        },

        handleRejectProsoy(row) {
            // this.reset();
            getProduceById(row.id).then(response => {
                const data = response.data;
                if (data.borrow && typeof data.borrow === 'string') {
                    try {
                        data.borrow = JSON.parse(data.borrow);
                    } catch (error) {
                        console.warn('解析 borrow 字段失败，使用空数组', error);
                        data.borrow = []; // 解析失败时给默认值
                    }
                } else if (!data.borrow) {
                    // 如果 borrow 为 null/undefined，初始化为空数组
                    data.borrow = [];
                }
                this.prosoyDialog = true;
                this.rejProsoyForm = data;
                this.uploadedAppyExcel.push({ name: '申请表', url: this.rejProsoyForm.appyExcel })
                this.uploadedSaleFile.push({ name: '销售凭证', url: this.rejProsoyForm.saleFile });
                this.title = "高油大豆补贴信息查看";
            });
        },


        // 表单重置
        reset() {
            this.queryParams = {
                idCard: undefined,
                bankCard: undefined,
                straName: '滴道区',
                villageName: undefined,
                townName: undefined,
                status: undefined,
                year: undefined,
            };
            this.resetForm("queryParams");
        },
        /** 搜索按钮操作 */
        handleQuery() {
            this.pageNum = 1;
            this.getList();
        },
        handlePreview(file) {
            const serveIpPort = "111.40.188.220";
            let originalUrl = '';
            if (Object.keys(file).includes('url')) {
                originalUrl = file.url;
            } else {
                originalUrl = file.response.data.filePath;
            }

            const fileUrl = originalUrl.replace(/http:\/\/[\d.]+/, `http://${serveIpPort}`);
            window.open(fileUrl);
        },
        handleExceed(files, fileList) {
            this.$message.warning(`当前限制选择 1 个文件，请删除现有文件后再选择新文件！`);
        },

        /** 重置按钮操作 */
        resetQuery() {
            this.resetForm("queryForm");
            this.handleQuery();
        },

        // 导出按钮
        handleExport() {
            container
            this.download('agriculture/compile/export', {
                ...this.queryParams
            }, `agriculture_${new Date().getTime()}.xlsx`)
        }
    }
};
</script>
  
<style scoped >
.app-container {
    width: 100%;
    height: 100%;
    background: white !important;
}

.card-container {
    background: white;
}

.el-scrollbar {
    height: 100px;
}

.el-select {
    .el-input__inner {
        width: 140px;
    }
}

.card-container {
    position: relative;
    width: 90%;
    align-items: center;
    margin-left: 5%;
    padding-bottom: 20px;
}

.infoDiv {
    width: 100%;
    align-items: center;
    border-radius: 8px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    padding-top: 20px;
}
.green-line {
  width: 100%;
  height: 2px;
  background-color: rgb(163, 215, 30);
  /* margin: 0 10px; */
}

.corner-label {
    position: absolute;
    top: 0;
    left: 0;
    background: #81B337;
    /* 背景色 */
    color: white;
    /* 文字颜色 */
    padding: 2px 8px;
    /* 内边距 */
    font-size: 20px;
    /* 字体大小 */
    border-radius: 4px;
    /* 圆角，左上角和右下角有圆角（根据需求调整） */
    transform: translate(-10%, -10%);
    /* 微调位置，使其覆盖在圆角上 */
    /* 如果需要，可以设置z-index */
    z-index: 1;
}

.demo-drawer__content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

::v-deep .demo-drawer .el-drawer__header {
    text-align: center;
    padding: 20px 0;
}


.demo-drawer__footer {
    align-items: center;
    text-align: center;
    margin-bottom: 20px;
}
</style>